#include "regex_rule.h"
#include "global.h"
  
using namespace std;
using namespace fouine;

RegexRule::RegexRule(const String& pattern)
:_ptn(new boost::wregex(pattern))
{
}


Likelihood RegexRule::test_match(const String& s) const
{
  return boost::regex_match(s, *_ptn);
}

Likelihood RegexRule::match(const String& s, StrId start, StrLen length, const Table& table) const
{
  if (boost::regex_match(s.substr(start, length), *_ptn))
    return 1.;
  else
    return 0.;
}
    
